#ifndef SNAKE4_H
#define SNAKE4_H

#include <QMainWindow>

namespace Ui {
class Snake4;
}

class Snake4 : public QMainWindow
{
    Q_OBJECT

public:
    explicit Snake4(QWidget *parent = 0);
    ~Snake4();
    void paintEvent(QPaintEvent *event);
            void initSnake();
            void initBoom();
            QRect CreateRect();
            void IsEat();
            void IsHit();
            void IsBoom();
            void IsLose();
            void keyPressEvent(QKeyEvent *event);
        private slots:
            void Snake_update();


private:
    Ui::Snake4 *ui;
    QVector<QRect> vSnakeRect;
            QRect vSnakeHead;
            QTimer *timer;//定时器
            int Direction;//蛇的移动方向
            bool Run;//是否开始
            bool Over;//是否结束
            bool Change;//炸弹是否变化
            bool Shorten;//是否缩短
            QRect food;
            QVector<QRect> boom;//炸弹
            int nScore;
            int speed;//移动速度
};

#endif // SNAKE4_H
